package com.zhangkang.stock.stocklib.view

import android.graphics.Canvas
import android.graphics.Paint
import com.zhangkang.stock.stocklib.data.KLineInfo

/**
 * @author : Android-张康
 * created on: 2023/5/9 11:00
 * description:
 */
interface KLineIndexInfo {

    /**
     * 获取K线指标类型
     */
    fun getKLineIndex(): KLineIndex

    fun getProportion(): Int

    /**
     * 计算最大值前
     *
     * @param kLineInfo 第一个值
     */
    fun calculationMaxAndMinBefore(kLineInfo: KLineInfo)

    /**
     * 计算最大值
     *
     * @param kLineInfo 当前值
     */
    fun calculationMaxAndMin(kLineInfo: KLineInfo)

    /**
     * 计算最大值后
     */
    fun calculationMaxAndMinAfter()

    /**
     * 绘制背景
     *
     * @param canvas 画布
     * @param startX 开始X
     * @param startY 开始Y
     * @param stopX 结束X
     * @param stopY 结束Y
     * @param linePaint 画布
     * @param textPaint 画布
     */
    fun drawBackground(
        canvas: Canvas,
        startX: Float,
        startY: Float,
        stopX: Float,
        stopY: Float,
        linePaint: Paint,
        textPaint: Paint
    )

    fun drawCurrentIndexInfo(
        canvas: Canvas,
        startX: Float,
        startY: Float,
        stopX: Float,
        stopY: Float,
        linePaint: Paint,
        textPaint: Paint,
        marginTop: Float,
        span: Int,
        indexValueHorizontalSpace: Float,
        indexValueVerticalSpace: Float,
        kLineInfo: KLineInfo,
        kLineIsLine: Boolean
    )

    fun beforeDrawItemContent(
        canvas: Canvas,
        startX: Float,
        startY: Float,
        stopX: Float,
        stopY: Float,
        paint: Paint,
        candlestickWidth: Float,
        candlestickWidthSpace: Float,
        kLineInfo: KLineInfo,
        kLineIsLine: Boolean
    )

    fun drawItemContent(
        canvas: Canvas,
        startX: Float,
        startY: Float,
        stopX: Float,
        stopY: Float,
        textPaint: Paint,
        linePaint: Paint,
        kLineInfo: KLineInfo,
        isFirst: Boolean,
        yangLineIsFill: Boolean,
        totalTranslateX: Float,
        candlestickWidth: Float,
        halfCandlestickWidth: Float,
        kLineIsLine: Boolean
    )

    fun afterDrawItemContent(canvas: Canvas, paint: Paint)

}